// pages/car/car.js
const app = getApp()
Component({

  /**
   * 页面的初始数据
   */
  data: {
    car: true,
    msg: []
  },
  attached() {
    if (app.globalData.userInfo.nickName) {
      let name = app.globalData.userInfo.nickName;
      let data = this.getNowFormatDate();
      let obj = {
        "date": data,
        "dateil": name + "欢迎您来到贱贱小程序....."
      }
      let msg = [];
      msg.push(obj)
      this.setData({
        msg: msg
      })
    }
  },
  methods: {
    //获取当前年-月-日
    getNowFormatDate() {
      var date = new Date();
      var seperator1 = "-";
      var year = date.getFullYear();
      var month = date.getMonth() + 1;
      var strDate = date.getDate();
      if (month >= 1 && month <= 9) {
        month = "0" + month;
      }
      if (strDate >= 0 && strDate <= 9) {
        strDate = "0" + strDate;
      }
      var currentdate = year + seperator1 + month + seperator1 + strDate;
      return currentdate;
    }
  },
  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function() {

  },
})